package org.enwey.icarenew.Component;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import org.enwey.icarenew.Model.Comment;
import org.enwey.icarenew.R;

/**
 * Created by John on 2/7/2015.
 */
public class NewHeaderItem extends LinearLayout {

    private ImageView mUserImg;
    private TextView mContent;
    private TextView mDate;

    public NewHeaderItem(Context context) {
        this(context, null, 0);
    }

    public NewHeaderItem(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public NewHeaderItem(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView();
    }

    private void initView() {
        LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view = inflater.inflate(R.layout.new_header_item,this);
        findView(view);
    }

    private void findView(View view) {
        mUserImg = (ImageView) view.findViewById(R.id.new_header_item_img);
        mContent = (TextView) view.findViewById(R.id.new_header_item_content);
        mDate = (TextView) view.findViewById(R.id.new_header_item_date);
    }

    public void setDate(Comment comment) {
        if (comment != null) {
//            mUserImg
            mContent.setText(comment.content);
            mDate.setText(comment.date);

        }
    }
}
